﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Security;
using erpIngesup.Areas.Eleve.Models;
using erpIngesup.Functions;

namespace erpIngesup.Areas.Eleve.Controllers
{
    public class AgendaController : Controller
    {
        private bddIngesupEntitiesEleve db = new bddIngesupEntitiesEleve();
        //
        // GET: /Eleve/Agenda/

        //[Authorize(Roles = "Eleve, Professeur")]
        public ActionResult Index(string langue)
        {
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Field.getLanguage(langue));
            string login = Session["login"] != null ? Session["login"].ToString() : "";
            var liste = db.COURS.Where(x => x.DATE_DBT == DateTime.Today && x.LOGINPERS == login).ToList();
            return View(liste);
        }

        //[Authorize(Roles = "Eleve, Professeur")]
        /*public ActionResult Consulter(string langue)
        {
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Field.getLanguage(langue));
            string login = Session["login"] != null ? Session["login"].ToString() : "";
            var liste = db.COURS.Where(x => x.DATE_DBT == DateTime.Today && x.LOGINPERS == login).ToList();
            return View(liste);
        }

        //[Authorize(Roles = "Eleve, Professeur")]
        [HttpPost]
        public ActionResult Consulter(COURS cours, string langue)
        {
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Field.getLanguage(langue));
            string login = Session["login"] != null ? Session["login"].ToString() : "";
            var liste = db.COURS.Where(x => x.DATE_DBT >= cours.DATE_DBT && x.DATE_FIN <= cours.DATE_FIN && x.LOGINPERS == login).ToList();
            return View(liste);
        }*/

    }
}
